<?php
/*
 * @Author: 乔
 * @Date: 2021-11-02 09:31:06
 * @LastEditTime: 2021-11-05 09:54:31
 * @LastEditors: 乔
 * @FilePath: \tp30\app\admin\validate\Login.php
 */

namespace app\admin\validate;

use think\Validate;

class Login extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'=>['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'code|验证码'    => 'require|captcha|token',
        'name|用户名'    => 'require|alphaNum',
        'password|密码' => 'require|alphaNum',
        'email|邮箱'    => 'require|email'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'=>'错误信息'
     *
     * @var array
     */
    protected $message = [];
    /**
     * 定义验证场景
     * 格式：'场景名'=>['规则1','规则2',...]
     *
     * @var array
     */
    protected $scene = [
        'register' => ['code', 'name', 'password', 'email'],
        'login'    => ['name', 'password'],
        'code'     => ['code'],
        'resPwd'   => ['name', 'code', 'email'],
        'qrPwd'    => ['password', 'code']
    ];
}
